import mnist
from PIL import Image
import numpy as np
import psutil


def img_show(img):
    pil_img = Image.fromarray(np.uint8(img))
    pil_img.show()



if __name__ == '__main__':
    train_images = mnist.train_images()
    
    process_list = []
    for proc in psutil.process_iter():
        process_list.append(proc)

    for img in train_images:
        print(img.shape)
        img = img.reshape(28,28)
        img_show(img)
        for proc in psutil.process_iter():
            if not proc in process_list:
                proc.kill()


